/*
 * @Author: your name
 * @Date: 2021-06-08 11:11:01
 * @LastEditTime: 2021-06-12 10:37:30
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \UDP\SERVER_\parse->cpp
 */

#include "parse.h"

void Parse::parse_Message(char* buf)
{
    //强转buf
    info* tinfo = (info*)buf;
    cout << "----------------------" << endl;
	cout << "com_src:" << tinfo->com_src << endl
		<< "opcode:" << tinfo->opcode << endl;
	printf("name:%s\n",tinfo->name);
	printf("passwd:%s\n",tinfo->passwd);
	printf("balance:%lf\n",tinfo->balance);

	cout << "购物车信息如下" << endl;
	cout << "购物车商品种类：" << tinfo->cartnum << endl;
	for(int i=0; i<tinfo->cartnum; i++)
	{
		cout << "商品编号：" << tinfo->cartIndexArray[i] << " 数目:" << tinfo->indexNumArray[i] << endl;
	}
	cout << "----------------------" << endl;
}

